* xsettings.c (init_gsettings): Use g_settings_schema_source_lookup
authorJan D. <jan.h.d@swipnet.se>
Sat, 10 May 2014 10:42:08 +0000 (12:42 +0200)
committerJan D. <jan.h.d@swipnet.se>
Sat, 10 May 2014 10:42:08 +0000 (12:42 +0200)
instead of deprecated g_settings_list_schemas if possible.

src/ChangeLog
src/xsettings.c

index 671fe7de2e81dd9404139d5f96b84be0b597b82d..1f5bb7b675886f77ef0d63bef7d2cfee56b9423c 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-10  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (init_gsettings): Use g_settings_schema_source_lookup
+       instead of deprecated g_settings_list_schemas if possible (Bug#17434).
+
 2014-05-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        * minibuf.c (read_minibuf): Avoid C99ism in previous patch (Bug#17430).
index 844da19f638e46000ab0d3540fba3dbbe9378683..5f4275df54521b3effe0c0e91ea519c464277dfb 100644 (file)
@@ -795,17 +795,29 @@ init_gsettings (void)
 {
 #ifdef HAVE_GSETTINGS
   GVariant *val;
-  const gchar *const *schemas;
   int schema_found = 0;
 
 #if ! GLIB_CHECK_VERSION (2, 36, 0)
   g_type_init ();
 #endif
 
-  schemas = g_settings_list_schemas ();
-  if (schemas == NULL) return;
-  while (! schema_found && *schemas != NULL)
-    schema_found = strcmp (*schemas++, GSETTINGS_SCHEMA) == 0;
+#if GLIB_CHECK_VERSION (2, 32, 0)
+  {
+    GSettingsSchema *sc = g_settings_schema_source_lookup
+      (g_settings_schema_source_get_default (),
+       GSETTINGS_SCHEMA,
+       TRUE);
+    schema_found = sc != NULL;
+    if (sc) g_settings_schema_unref (sc);
+  }
+#else
+  {
+    const gchar *const *schemas = g_settings_list_schemas ();
+    if (schemas == NULL) return;
+    while (! schema_found && *schemas != NULL)
+      schema_found = strcmp (*schemas++, GSETTINGS_SCHEMA) == 0;
+  }
+#endif
   if (!schema_found) return;
 
   gsettings_client = g_settings_new (GSETTINGS_SCHEMA);